%% Temp_cal
function [Tz,Tpj]=Temp_cal(T0,Tq,Pq,Pz,Qa,relative_den,D)
%M=Qa*density;    %kg/s
Cp=2.17*10^3;    % J/(kg*K)
Di=2.5; % K/MPa
K=0.65;  %W/m-K, by SPS
del_x=1;    %km
D=D/1000;   %m,outsideD
Qa=Qa*(24*3600);    %m3/d

a=225.256*10^6*K*D/(Qa*relative_den*Cp);
%a=K*pi*d/(M*Cp);
Tz=T0+(Tq-T0)*exp(-a*del_x)...
    -Di*(Pq-Pz)/(a*del_x)*(1-exp(-a*del_x));

Tpj=T0+(Tq-T0)*(1-exp(-a*del_x))/(a*del_x);

end